package com.chapter01exercise.homework13;

/**
 * @Author 小闽
 * @Date 2024/8/21 10:06
 * @PackageName: com.chapter01exercise.homework13
 * @ClassName: Teacher
 * @Description: 老师类
 * @Version 1.0
 */
public class Teacher extends Person {
    private int work_age;
    /**
     * 构造器
     * @param name
     * @param sex
     * @param age
     * @param work_age
     */
    public Teacher(String name, char sex, int age, int work_age) {
        super(name, sex, age);
        this.work_age = work_age;
    }
    public int getWork_age() {
        return work_age;
    }

    public void setWork_age(int work_age) {
        this.work_age = work_age;
    }
    /**
     * 定义老师的teacher()方法
     */
    public void teacher(){
        System.out.println("我承诺，我会认真教学");
    }
    /**
     * 重写父类的play()方法
     */
    @Override
    public String play() {
        return super.play() + "爱玩象棋";
    }
    /**
     * 定义打印老师信息的方法
     */
    public void printInfo(){
        System.out.println("老师的信息：");
        System.out.println(super.getInfo() + "\n" + "工龄：" + "\t" + getWork_age());
        teacher();
        System.out.println(play());
        System.out.println("-------------------------");
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "work_age=" + work_age +
                '}' + super.toString();
    }
}
